import React, { PureComponent } from 'react';
import StudentDashboard from './StudentDashboard'
import {noWechat,checkHost} from '@/utils/utils'
import {history} from 'umi'
import {Modal} from 'antd'
class Index extends PureComponent {
    constructor(props:any){
        super(props);
        const userinfo = JSON.parse(localStorage.getItem('userinfo') || '{}');
        const hasTwo:any = localStorage.getItem('hasTwo')||2;
        const openid = userinfo.openid;
        if (checkHost()) {
            if (!openid&&hasTwo!=1) {
                Modal.confirm({
                    title: <p style={{ fontSize: 20, marginTop: -3 }}>操作提醒</p>,
                    content: <p style={{ fontSize: 18 }}>新用户请绑定您的微信账号解锁培训练习权限，绑定成功后每次登录平台请使用微信进行扫码登录即可。</p>,
                    okText: '去绑定',
                    style: { fontSize: 30, color: "#f60" },
                    onOk: () => {
                        location.href = `/index/index/login_weixin`;
                    },
                });
                history.goBack();
            }
        }

    }
    render() {
        return (
            <div>
                <StudentDashboard params={this.props.location.query}/>
            </div>
        );
    }
}

export default Index;
